<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<style type="text/css">
		table{
			border-collapse: collapse;
		}
	</style>
	<script type="text/javascript">
			function add(){
		var table=document.getElementById("mytab");
		var tr=document.createElement("tr");
		for(var i=1;i<5;i++){
			var td=document.createElement("td");
			td.style.height="30px";
			tr.appendChild(td);
		}
		table.appendChild(tr);
	}
	function del(){
		var table=document.getElementById("mytab");
		var tr=table.lastChild;
		var td=tr.childNodes;
		if(table.rows.length==1){
			alert("最后一行不可删除!");
		}else{
				table.removeChild(tr);
			}
		}
	</script>
	<body>
		<from>
			<table id="mytab" width="300px" height="30px" border="1">
				<tr>
					<td height="30px"></td>
					<td></td>
					<td></td>
					<td></td>
				</tr>
			</table>
			<input type="button" value="添加一行" onclick="add()" />
			<input type="button" value="删除最后一行" onclick="del()" />
		</from>
	</body>
</html>
